{include file="public/_meta" /}

<body>
<div class="wrapper">

    {include file="public/_header" /}

    <!-- Sidebar -->
    {include file="public/_menu" /}
    <!-- End Sidebar -->

    <div class="main-panel">

        <div class="content">
            <div class="page-inner">

                <!-- 面包屑 -->
                {include file="public/_page_header" /}


                <div class="row">
                    <div class="col-md-12">
                        <div class="card">
                            <div class="card-header">

                                <form class="row">
                                    <div class="col-md-6 col-lg-3">
                                        <div class="form-group">
                                            <input type="text" class="form-control" name="start_time" id="start_time" value="{$start_time}" placeholder="开始时间" autocomplete="off">
                                        </div>
                                    </div>
                                    <div class="col-md-6 col-lg-3">
                                        <div class="form-group">
                                            <input type="text" class="form-control" name="end_time" id="end_time" value="{$end_time}" placeholder="结束时间" autocomplete="off">
                                        </div>
                                    </div>
                                    <div class="col-md-6 col-lg-3">
                                        <div class="form-group">
                                            <input type="text" class="form-control" id="clue_name" name="clue_name" value="{$clue_name}" placeholder="线索名称">
                                        </div>
                                    </div>
                                    <div class="col-md-6 col-lg-3">
                                        <div class="form-group">
                                            <input type="text" class="form-control" id="mer_name" name="mer_name" value="{$mer_name}" placeholder="商户名称">
                                        </div>
                                    </div>
                                    <div class="col-md-6 col-lg-3">
                                        <div class="form-group">
                                            <button type="submit" class="btn btn-primary">查询</button>
                                            <a href="{:url('RequestLog/index')}" class="btn btn-info" style="color: white;position: absolute;left: 110px;">重置</a>
                                        </div>
                                    </div>
                                </form>

                            </div>
                            <div class="card-body">


                                <div class="table-responsive">
                                    <table id="add-row" class="display table table-striped table-hover">
                                        <thead>
                                        <tr>
                                            <th>ID</th>
                                            <th>时间</th>
                                            <th>线索池ID</th>
                                            <th>线索名称</th>
                                            <th>分发商户</th>
                                            <th>分发商户地址</th>
                                            <th>请求</th>
                                            <th>返回</th>

                                        </tr>
                                        </thead>

                                        <tbody>

                                        {volist name="systemLogs" id="vo"}
                                        <tr>
                                            <td>{$vo.id}</td>
                                            <td>{$vo.create_time}</td>
                                            <td>{$vo.clue_id}</td>
                                            <td>{$vo.clue_name}</td>
                                            <td>{$vo.mer_name}</td>
                                            <td>{$vo.api_url}</td>
                                            <td>
                                                <div class="form-button-action">
                                                    <button type="button" title="内容" class="btn btn-info btn-sm" onClick="edit_item('{$vo.id}',1)">
                                                        请求信息
                                                    </button>
                                                </div>
                                            </td>
                                            <td>
                                                <div class="form-button-action">
                                                    <button type="button" title="内容" class="btn btn-info btn-sm" onClick="edit_item('{$vo.id}',2)">
                                                        返回信息
                                                    </button>
                                                </div>
                                            </td>
                                        </tr>
                                        {/volist}

                                        </tbody>
                                    </table>

                                    <!-- 分页 (调取通用方法)-->
                                    <div class="layui-box layui-laypage layui-laypage-molv">{:pagination($systemLogs)}</div>

                                </div>
                            </div>
                        </div>
                    </div>
                </div>


            </div>
        </div>

        {include file="public/_footer" /}


    </div>


</div>

{include file="public/_js" /}

</body>
<script>

    var SCOPE = {
        'item_url':"{:url('RequestLog/edit')}",
    };
    laydate.render({
        elem: '#start_time'
        ,type: 'datetime'
    });
    laydate.render({
        elem: '#end_time'
        ,type: 'datetime'
    });

    function edit_item(id,type)
    {

        $.ajax({
            type: 'GET',
            url: SCOPE.item_url,
            dataType: 'json',
            data: {id:id},
            success: function(res){
                if(res.code == 1001){

                    if(type == 1){
                        var content = res.data.req;
                    }else if(type == 2){
                        var content = res.data.res;
                    }

                    layer.open({
                        type: 1,
                        area: '500px',
                        content: '<p style="padding: 20px">'+content+'</p>' //这里content是一个普通的String
                    });
                }else{
                    layer.msg(res.msg,{icon:2,time:2000});
                }

            },
            error:function(res) {
                layer.msg('网络错误,稍后再试...',{icon:2,time:2000});
            }
        });


    }



</script>

</html>